<?php echo Modules::run('content/header_content') ?>
 
<div class="container main">
	<div>
      
      
		<div class="15">
			<div class="row">
				<div class="span15 content">
  						<h1>Order Information</h1>  
          		</div>
        	</div>
        	<div class="row">
        		<?php $user_id = Modules::run('auth/get_user_id');
		
			  		$cus = $this->order_model->get_customer_by_user($user_id); ?>
                    <?php $currency = $this->currency->getCurrency();?>
          
          		<div class="span15 content">
            		<div class="row box-product-row box">
              			<div class="just list" id="orderHistoryInfo">
                        	<table class="table table-bordered">
                            	<thead> 
                                	<tr>
                                    	<td colspan="2">Order Details </td>
                                    </tr>
                                </thead>
                                	<tr>
                                    	<td>
                                        	<b>Order Code : </b> <?php echo $order->order_cid; ?> <br />
                                            <b>Date Added : </b> <?php echo $order->date_added; ?>
                                        </td>
                                        <td>
                                        	<b>Payment Method : </b>
                                            <?php if($order->payment_method == 1){
													echo 'Cash On Delivery';
												}else if($order->payment_method == 2){
													echo 'Transfer Bank';
												} ?> 
                                            <br />
                                            <!--<b>Shipping Method : </b> <?php echo $order->shipping_method; ?>-->
                                        </td>
                                    </tr>
                            </table>
                            <table class="table table-bordered">
                            	<thead> 
                                	<tr>
                                    	<td>Order Address </td>
                                    </tr>
                                </thead>
                                	<tr>
                                    	<td>
                                        	<b>Name : </b><?php echo $order->payment_firstname ?> <?php echo $order->payment_lastname ?><br />
                                            <b>Address 1 : </b><?php echo $order->payment_address_1 ?><br />
                                            <b>Address 2 : </b><?php echo $order->payment_address_2 ?><br />
                                            <b>State/City : </b><?php echo $order->payment_city ?><br />
                                            <b>Zip Code : </b><?php echo $order->payment_postcode ?><br />
                                            <b>Region : </b><?php echo $order->payment_zone ?><br />
                                            <b>Country : </b><?php echo $order->payment_country ?><br />
                                        </td>
                                    </tr>
                            </table>
                            <table class="table table-bordered">
                            	<thead> 
                                	<tr>
                                    	<td>Order ID</td>
                                        <td>Shipping</td>
                                        <td>Image </td>
                                    	<td>Product Name </td>
                                        <td>Quantity </td>
                                        <td>Unit Price </td>
                                        <td>Total </td>
                                    </tr>
                                </thead>
                                	<?php $order_product = $this->order_model->get_order_products_by_cid($order->order_cid); ?>
                                    <?php $order_total = $this->order_model->order_total_by_cid($order->order_cid); ?>
                                    <?php foreach($order_product as $product){ ?>
                                	<tr>
                                    	<td class="right"><a href="<?php echo site_url('account/order_info_id/'.$product->order_id);?>" title = "View"><i class="icon-list-alt"></i></a>&nbsp;&nbsp;<?php echo $product->order_id ?></td>
                                        <?php $shipping = $this->account_model->get_shipping_by_product($product->product_id) ?>
										<?php if($shipping->shipping_method == '0'){ ?>
                                        	<td>--</td>
                                        <?php }else{ ?>
                                            <td><?php echo $shipping->shipping_method; ?> : <?php echo $this->currency->format($shipping->price, $currency); ?></td>
                                        <?php } ?>
                                        
                                        <?php $products = $this->account_model->get_product($product->product_id); ?>
                                        <?php foreach($products as $pro){ ?>
                                        <td><img style="width:48px;height:48px;" src="<?php echo base_url('data/thumb/'.$pro->image_file) ?>"></td>
                                        <?php } ?>
                                    	<td>
                                    		<?php echo $product->name; ?><br>
       										<?php $opt = $this->order_model->get_order_option_by_order_product($product->order_product_id);
       											  if($opt != NULL){
       											  	echo $opt->option_name.' : '.$opt->option_value;
       											  } 
       										?>
                                    	</td>
                                        <td class="right"><?php echo $product->quantity; ?></td>
										<td class="right"><?php echo $this->currency->format($product->price, $currency); ?></td>
										<td class="right"><?php echo $this->currency->format($product->subtotal, $currency); ?></td>
                                    </tr>
                                    <?php } ?>
                                    <tr>
                                    	<td colspan="6" class="right">Sub-Total</td>
                                        <?php $sub_total = $this->order_model->sub_total_order_by_cid($order->order_cid); ?>
                                        <?php foreach($sub_total as $sub){ ?>
                                        	<td class="right"><?php echo $this->currency->format($s = $sub->subtotal, $currency); ?></td>
                                        <?php } ?>
                                    </tr>
                                    
                                    <?php $total_code_s = $this->order_model->order_total_by_cid_code($order->order_cid, 'total_shipping') ?>
                                   	<tr>
                                    	<td colspan="6" class="right">Total Shipping</td>
                                        <td class="right">
                                        	<?php echo $this->currency->format($h = $total_code_s->value, $currency); ?>
                                        </td>
                                    </tr>
                                    <?php $total_code_x = $this->order_model->order_total_by_cid_code($order->order_cid, 'tax') ?>
                                    <tr>
                                    	<td colspan="6" class="right">Total Tax</td>
                                        <td class="right">
                                        	<?php echo $this->currency->format($x = $total_code_x->value, $currency); ?>
                                        </td>
                                    </tr>
                                    <tr>
                                    	<td colspan="6" class="right">Total</td>
                                        <td class="right"><?php echo $this->currency->format($s+$h+$x, $currency); ?></td>
                                    </tr>
                                    
                                    
                            </table>
                            <div id="order-back">
								<a href="<?php echo site_url('account/order'); ?>" class="btn" id="cancel" type="button" name="back" value="Back">Back</a> 
       					 	</div>
              			</div>
			  
              			<div class="clearfix">
           				</div>
          			</div>
        		</div>
      		</div>
    	</div>
  	</div>
</div>



<?php echo Modules::run('content/footer_content') ?>